package com.agileboot.domain.system.file.query;

import cn.hutool.core.util.StrUtil;
import com.agileboot.common.core.page.AbstractPageQuery;
import com.agileboot.domain.system.file.db.SysFileEntity;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 系统文件查询类
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class SysFileQuery extends AbstractPageQuery<SysFileEntity> {
    
    private String fileName;
    
    private String bizType;
    
    private String storageType;

    @Override
    public QueryWrapper<SysFileEntity> addQueryCondition() {
        QueryWrapper<SysFileEntity> queryWrapper = new QueryWrapper<SysFileEntity>()
                .like(StrUtil.isNotEmpty(fileName), "file_name", fileName)
                .eq(StrUtil.isNotEmpty(bizType), "biz_type", bizType)
                .eq(StrUtil.isNotEmpty(storageType), "storage_type", storageType);
        
        this.setTimeRangeColumn("create_time");
        
        return queryWrapper;
    }
}

